﻿@{
    string guid = Html.Guid();
    var mustFillInformation = Request.QueryString["MustFillInformation"];
    CurrentUser currentUser =ViewBag.CurrentUser;
}
<div class="current-location">
    <ul>
        <li class="left"><i class="glyphicon glyphicon-home"></i><a href="javascript:void(0)" onclick="location.href=location.href">基本资料</a></li>
    </ul>
</div>
<div class="main">
    <form method="post" id="_form" class=" form  ui-validForm" data-validate-params="beforeSubmit:'BeforeSubmit'" data-source="@ViewBag.MemberData">
        @{
            string beforeSubmitJs = "";
            var data = new ViewDataDictionary();
            data.Add("from", "member");
            data.Add("guid", guid);
            data.Add("currentUser", currentUser);
            data.Add("detailId", currentUser.Uid);
            data.Add("i", 0);
            IEnumerable<dynamic> FieldData = ViewBag.FieldData;
            int i = 0;
            if (FieldData != null)
            {
                foreach (var row in FieldData)
                {
                    data["i"] = i;
                    beforeSubmitJs += row.BeforeSubmitJs;
                    Html.RenderPartial("~/Areas/E/Views/CustomForm/FormPartial.cshtml", (object)row, data);
                    i++;
                }
            }

        }
        <script type="text/javascript">
                function BeforeSubmit() {
                     @Html.Raw(beforeSubmitJs)
                    return true;
                }
        </script>

        <div class="postarea">
            <div class="form-group">
                <div class="controls">
                    <input type="hidden" id="Id" name="Id" value="0" />
                    <input type="hidden" id="Guid" name="Guid" value="@guid" />
                    <input type="hidden" id="State" name="State" value="1" />
                    <input type="hidden" id="IsAdmin" name="IsAdmin" value="0" />
                    <input type="hidden" id="Logins" name="Logins" value="0" />
                    <input type="hidden" id="Password" name="Password" value="" />
                    <input type="hidden" id="MemberGroupId" name="MemberGroupId" value="0" />
                    <input type="hidden" id="DepartmentId" name="DepartmentId" value="0" />
                    <input type="hidden" name="Email" id="Email" value="">
                    <input type="hidden" name="Mobile" id="Mobile" value="">
                    <input type="hidden" id="Username" name="Username" />
                    <input type="hidden" id="MustFillInformation" name="MustFillInformation" value="@mustFillInformation"/>
                    <button type="button" class="btn  btn-primary ui-pagePost" data-custom-params="url:'@Url.ActionUrl()',callBack:'PostBack'">提交保存</button>
                </div>
            </div>
        </div>
    </form>
</div>

<script type="text/javascript">
                $("#_form").FormBind({ dataSourceFrom: "attr" });
                var mustFillInformation = "@mustFillInformation";
 function PostBack()
{
     if (mustFillInformation == "1")
     {
         Alert("信息保存成功!", { title: '提示', icon:1,  },function () {
             CloseDialog();
         })
     }
}
</script>